home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / memory / demm.zip / DEMM.ASM next >
Assembly Source File  |  1986-10-08  |  9KB  |  146 lines

  1. ;*--------------------------------------------------------------------*
  2. ;* DEMM -- This is a MicroSoft Assembler Version 4.00 program to      *
  3. ;*         read the Lotus/Intel/MicroSoft (LIM) Expanded Memory       *
  4. ;*         Manager Statistics and display them.                       *
  5. ;*                                                                    *
  6. ;* Author: J.C. Weilandt II  Date: 10-07-87  Last Update: 10-08-86    *
  7. ;*--------------------------------------------------------------------*
  8.          extrn  stdout:far        ;declare stdout print char function
  9.          extrn  dec16out:far      ;declare 16-bit binary to decimal
  10.          extrn  return:far        ;declare standard DOS Exit
  11.          extrn  prtstr:far        ;declare DOS Print String function
  12.          extrn  clrscr:far        ;declare clear screen function
  13.          extrn  hex16out:far      ;declare 16-bit binary to display hex
  14.          extrn  stdcrlf:far       ;declare carriage return/lf output
  15. ;*--------------------------------------------------------------------*
  16. ;* Define Stack Segment Of 1024 Bytes (2 * 512)                       *
  17. ;*--------------------------------------------------------------------*
  18. stack    segment para stack 'STACK' ;Declare stack segment
  19.          dw    512 dup (?)        ;Define stack space (1024 bytes)
  20. stack    ends                     ;terminate stack segment
  21. ;*--------------------------------------------------------------------*
  22. ;* Define Data Segment (message holder)                               *
  23. ;*--------------------------------------------------------------------*
  24. data     segment para 'DATA'      ;Declare data segment
  25. abuff    dw    512 dup (?)        ;Define alloc map buffer
  26. mess0    db    '               Weilandt Software International',0dh,0ah
  27.          db    '               Expanded Memory Manager Stats  ',0dh,0ah
  28.          db    0dh,0ah
  29.          db    '               DEMM.EXE Version 1.01 10-08-86 ',0dh,0ah
  30.          db    0dh,0ah,'$'
  31. mess1    db    '    --> Total Pages Expanded Memory',0dh,0ah,'$'
  32. mess2    db    '    --> Free  Pages Expanded Memory',0dh,0ah,'$'
  33. mess3    db    '   --> LIM/EMM Version Number     ',0dh,0ah,'$'
  34. mess4    db    ' LIM/EMM Memory Manager Not Installed',0dh,0ah,'$'
  35. mess5    db    '  --> LIM/EMM Page Frame Segment Address',0dh,0ah,'$'
  36. mess6    db    '     --> Number of EMM Handles Allocated',0dh,0ah,'$'
  37. mess7    db    0dh,0ah
  38.          db    '               Expanded Memory Allocation',0dh,0ah
  39.          db    0dh,0ah
  40.          db    'Handle         Number Of Pages',0dh,0ah
  41.          db    '------         ---------------',0dh,0ah,'$'
  42. mess8    db    '                 ','$'
  43. data     ends                     ;terminate data segment
  44. ;*--------------------------------------------------------------------*
  45. ;* Define Code Segment                                                *
  46. ;*--------------------------------------------------------------------*
  47. demm     segment                  ;segment header declaration
  48.          assume cs:demm,ss:stack,ds:data ;segment register assumptions
  49. main     proc                     ;main procedure header
  50.          mov   ax,data            ;get address of data segment
  51.          mov   ds,ax              ;store address in segment register
  52.          call  clrscr             ;clear the video screen
  53.          mov   dx,offset mess0    ;get address of welcome message
  54.          call  prtstr             ;print the message
  55.          mov   ah,42h             ;LIM Function code for Page Stats
  56.          int   67h                ;Issue LIM interrupt
  57.          or    ah,ah              ;q.LIM/EMM Hardware OK ??
  58.          jz    next1              ;  yes, continue
  59.          jmp   not_here           ;  nope, exit
  60. next1:
  61.          call  dec16out           ;write out DX contents (total pg)
  62.          mov   dx,offset mess1    ;get address of total message
  63.          call  prtstr             ;write out total message
  64.          mov   dx,bx              ;load free pages num into DX
  65.          call  dec16out           ;write out DX contents (free pg)
  66.          mov   dx,offset mess2    ;get address of free message
  67.          call  prtstr             ;write out the free message
  68.          mov   ah,46h             ;LIM Version Number Function Code
  69.          int   67h                ;Issue LIM interrupt
  70.          or    ah,ah              ;q.LIM/EMM Hardware OK ??
  71.          jz    next2              ;  Yes, continue
  72.          jmp   not_here           ;  Nope, error exit
  73. next2:
  74.          mov   bl,al              ;save LIM Version Number
  75.          mov   cl,4               ;load number of bits to shift
  76.          shr   al,cl              ;move high nibble to low
  77.          add   al,30h             ;make number display
  78.          call  stdout             ;write number out
  79.          mov   al,'.'             ;load display period
  80.          call  stdout             ;write out the period
  81.          mov   al,bl              ;reload LIM/EMM Version Number
  82.          shl   al,cl              ;move low nibble to high
  83.          shr   al,cl              ;move it back (cleared of high)
  84.          add   al,30h             ;make number display
  85.          call  stdout             ;write number out
  86.          mov   dx,offset mess3    ;get address of version message
  87.          call  prtstr             ;write out the version message
  88.          mov   ah,41h             ;load get frame address code
  89.          int   67h                ;LIM/EMM Manager interrupt
  90.          or    ah,ah              ;q.LIM/EMM Hardware OK ??
  91.          jz    next3              ;  Yes, continue
  92.          jmp   not_here           ;  Nope, error exit
  93. next3:
  94.          mov   dx,bx              ;move address to output regs
  95.          call  hex16out           ;display the address
  96.          mov   dx,offset mess5    ;get address of segment message
  97.          call  prtstr             ;write out the segment message
  98.          mov   ah,4bh             ;load get frame address code
  99.          int   67h                ;LIM/EMM Manager interrupt
  100.          or    ah,ah              ;q.LIM/EMM Hardware OK ??
  101.          jz    next4              ;  Yes, continue
  102.          jmp   not_here           ;  Nope, error exit
  103. next4:
  104.          mov   dx,bx              ;move address to output regs
  105.          call  dec16out           ;display the address
  106.          mov   dx,offset mess6    ;get address of segment message
  107.          call  prtstr             ;write out the segment message
  108.          mov   dx,offset mess7    ;get address of alloc map msg
  109.          call  prtstr             ;write out the map message
  110.          mov   di,seg abuff       ;get address of abuff
  111.          mov   es,di              ;load extended segment register
  112.          mov   di,offset abuff    ;load index pointer
  113.          mov   ah,4dh             ;load EMM Function code
  114.          int   67h                ;LIM/EMM Manager interrupt
  115.          or    ah,ah              ;q.LIM/EMM Hardware OK ??
  116.          jz    next5              ;  Yes, continue
  117.          jmp   not_here           ;  Nope, error exit
  118. next5:
  119.          mov   cx,bx              ;number of handles in counter
  120.          mov   di,offset abuff    ;point to beginning of buffer
  121. abuffl1:
  122.          push  cx                 ;save counter registers
  123.          mov   dx,[di]            ;load handle number
  124.          call  dec16out           ;write out handle number
  125.          inc   di                 ;increment pointer
  126.          inc   di                 ;increment pointer
  127.          mov   dx,offset mess8    ;get space message address
  128.          call  prtstr             ;write out the space
  129.          mov   dx,[di]            ;load number of pages
  130.          call  dec16out           ;write out number of pages
  131.          inc   di                 ;increment pointer
  132.          inc   di                 ;increment pointer
  133.          call  stdcrlf            ;write a carriage return/lf
  134.          pop   cx                 ;restore counter registers
  135.          loop  abuffl1            ;process all array elements
  136. exit:
  137.          mov   ax,4c00h           ;load DOS Terminate Code
  138.          int   21h                ;issue DOS terminate function
  139. not_here:
  140.          mov   dx,